Obtaining and Setting the Video Format

The BITMAPINFO.2PXNH structure is of variable length to accommodate standard and compressed data formats. Because this structure is of variable length, applications must always query the size of the structure and allocate memory before retrieving the current video format. The following example uses the capGetVideoFormatSize1ISFPV_ macro to retrieve the buffer size and then calls the capGetVideoFormat6HHPCP macro to retrieve the current video format.

LPBITMAPINFO lpbi;

DWORD dwSize;

 

dwSize = capGetVideoFormatSize(hWndC);

lpbi = GlobalAllocPtr (GHND, dwSize);

capGetVideoFormat(hWndC, lpbi, dwSize);

 

// Access the video format and then free the allocated memory.

 

Applications can use the capSetVideoFormatS9Q3H7 macro (or the WM_CAP_SET_VIDEOFORMAT19WJSQM message) to send a BITMAPINFO.2PXNH header structure to the capture window. Because video formats are device specific, your application should check the return value to determine if the format was accepted.